<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:82:"/Users/ztos/workspace/shyp/public/../application/admin/view/partybuilding/add.html";i:1510975931;s:76:"/Users/ztos/workspace/shyp/public/../application/admin/view/base/common.html";i:1510722990;}*/ ?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title><?php echo \think\Config::get('web_site_title'); ?> | 超级后台</title>
    <!-- CSS Files -->
    <link href="/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/admin/font-awesome/css/font-awesome.css" rel="stylesheet">
    <link href="/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <style type="text/css">
        .profile-element { text-align: center; }
        .img-circle {  width:48px; }
        .label small{
            font-size: 12px !important;
        }
    </style>

    <!-- iCheck -->
    <link href="/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <!-- Sweet Alert -->
    <link href="/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!-- Toastr style -->
    <link href="/admin/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <!-- CSS Files -->
    <link href="/admin/css/animate.css" rel="stylesheet">
    <link href="/admin/css/style.css" rel="stylesheet">
    <link href="/admin/css/main.css" rel="stylesheet">
    <script src="/static/js/jquery-3.1.1.min.js"></script>
    <script src="/static/js/jquery-migrate-3.0.0.min.js"></script>
    
<link href="/static/summernote/summernote.css" rel="stylesheet">
<link href="/static/bootstrap-fileinput/css/fileinput.min.css" rel="stylesheet">
<link href="/static/js/jQuery-imgBox/imgbox.css" rel="stylesheet"/>
<style type="text/css">
    .note-editor.note-frame { border-radius: 0; border:0; margin-bottom: 0; }
    .front_cover_img {height: 40px; width: 40px; margin-top: 4px}
    .send_type_label {
        padding-left: 12px;
    }
</style>

</head>
<body>
<div id="wrapper">
    <!-- 左侧系统菜单栏 -->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav metismenu" id="side-menu">
                <div class="nav-header">
                    <div class="dropdown profile-element">
                        <span><?php if($user_auth['header'] == ''): ?><img alt="image" class="img-circle" src="/admin/images/profile_small.jpg" /><?php else: ?><img alt="image" style="width: 48px;height: 48px;" class="img-circle" src="<?php echo $user_auth['header']; ?>" /><?php endif; ?></span>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                            <span class="clear"> <span class="block m-t-xs"> <strong class="font-bold"></strong></span>
                            <span class="text-muted text-xs block"><?php echo $user_auth['group_name']; ?><b class="caret"></b></span> </span> </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <li><a href="<?php echo Url('User/profile'); ?>">个人信息</a></li>
                            <li><a href="<?php echo Url('Message/index'); ?>">消息中心</a></li>
                            <li class="divider"></li>
                            <li><a href="<?php echo Url('Base/logout'); ?>">退出</a></li>
                        </ul>
                    </div>
                    <div class="logo-element">VAN+</div>
                </div>
                <?php if(is_array($__MENU__) || $__MENU__ instanceof \think\Collection || $__MENU__ instanceof \think\Paginator): $i = 0; $__LIST__ = $__MENU__;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;if(empty($menu['child']) || (($menu['child'] instanceof \think\Collection || $menu['child'] instanceof \think\Paginator ) && $menu['child']->isEmpty())): if($menu['id'] == $subMenu['id']): ?><li class="active"><?php else: ?><li><?php endif; ?>
                <a href="<?php echo Url($menu['url']); ?>"><i class="fa <?php echo $menu['icon']; ?>"></i><span class="nav-label"><?php echo $menu['title']; ?></span></a></li>
                <?php else: if($subMenu['pid'] == $menu['id']): ?><li class="active"><?php else: ?><li><?php endif; ?>
                <a href="<?php echo Url($menu['url']); ?>"><i class="fa <?php echo $menu['icon']; ?>"></i> <span class="nav-label"><?php echo $menu['title']; ?></span>
                    <?php if($menu['url'] == 'admin/Message/index'): ?>
                    <span class="label label-warning pull-right"><?php echo $messageTotal; ?></span>
                    <?php else: ?>
                    <span class="fa arrow"></span>
                    <?php endif; ?>
                </a>
                <ul class="nav nav-second-level collapse <?php if($subMenu['pid'] == $menu['id']): ?>in<?php endif; ?>">
                    <?php if(is_array($menu['child']) || $menu['child'] instanceof \think\Collection || $menu['child'] instanceof \think\Paginator): $i = 0; $__LIST__ = $menu['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$child): $mod = ($i % 2 );++$i;if($subMenu['id'] == $child['id']): ?><li class="active"><?php else: ?><li><?php endif; ?>
                    <a href="<?php echo Url($child['url']); ?>"><?php echo $child['title']; ?></a></li>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </ul></li>
                <?php endif; endforeach; endif; else: echo "" ;endif; ?>
            </ul>
        </div>
    </nav>
    <!-- 右侧主体内容 -->
    <div id="page-wrapper" class="gray-bg">
        <!-- 中间头部 -->
        <div class="row border-bottom">
            <nav class="navbar navbar-static-top white-bg" role="navigation" style="margin-bottom: 0">
                <div class="navbar-header">
                    <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
                    <form role="search" class="navbar-form-custom" action="<?php echo Url('Index/search'); ?>">
                        <div class="form-group">
                            <input type="text" placeholder="搜索内容" class="form-control" name="top-search" id="top-search">
                        </div>
                    </form>
                </div>
                <ul class="nav navbar-top-links navbar-right">
                    <li>
                        <span class="m-r-sm text-muted welcome-message">欢迎使用<?php echo \think\Config::get('web_site_title'); ?></span>
                    </li>
                    <li class="dropdown">
                        <a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
                            <i class="fa fa-envelope"></i><span class="label label-warning"><?php echo $messageTotal; ?></span>
                        </a>
                    </li>
                    <li>
                        <a href="<?php echo Url('Base/logout'); ?>"><i class="fa fa-sign-out"></i> 退出</a>
                    </li>
                    <li>
                        <a class="right-sidebar-toggle"><i class="fa fa-tasks"></i></a>
                    </li>
                </ul>
            </nav>
        </div>
        <!-- 页面路径 -->
        


        <!-- 中间主体内容 -->
        
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="mail-box-header">
            <div class="pull-right tooltip-demo">

                <a href="<?php echo Url('index'); ?>" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top"><i class="fa fa-times"></i> 关闭</a>
            </div>
                <h2>
                    新闻添加
                </h2>
        </div>
        <div class="mail-box">
            <form class="form-horizontal" method="post">
                <div class="mail-body">
                    <div class="form-group"><label class="col-sm-2 control-label">新闻类型:</label>
                        <div class="col-sm-10">
                            <select name="type" id="" class="col-sm-2">
                                <option value="1" <?php if($news['type'] == '1'): ?>selected<?php endif; ?>>产品服务</option>
                                <option value="2" <?php if($news['type'] == '2'): ?>selected<?php endif; ?>>行业资讯</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group"><label class="col-sm-2 control-label">新闻标题:</label>
                        <div class="col-sm-10"><input type="text" class="form-control" placeholder="消息的标题" name="title" value='<?php echo $news['title']; ?>'></div>
                    </div>
                    <div class="clearfix"></div>
                    <div class="mail-text h-200">
                        <div class="summernote"><?php echo $news['content']; ?></div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="mail-body text-right tooltip-demo">

                        <button url="<?php echo Url('add'); ?>" class="btn btn-sm btn-primary ajax-post" target-form="form-horizontal"
                                data-toggle="tooltip" data-placement="top" data-edit="content">
                            <i class="fa fa-reply"></i> 添加
                        </button>
                        <a href="<?php echo Url('index'); ?>" class="btn btn-white btn-sm" data-toggle="tooltip" data-placement="top"><i class="fa fa-times"></i> 关闭</a>
                    </div>
                    <div class="clearfix"></div>
                    <input type="hidden" name="content" class="to_hiden" value="">
                    <input type="hidden" name="id" value="<?php echo $news['id']; ?>">
                </div>
            </form>
        </div>
    </div>
</div>

        <!-- 底部信息 -->
        <div class="footer">
            <div class="pull-right">版本 <strong><?php echo \think\Config::get('web_version'); ?></strong></div>
            <div><strong>Copyright</strong> <?php echo \think\Config::get('web_company_name'); ?> &copy; 2016-2017</div>
        </div>
    </div>
    <!-- 右侧工具栏 -->
</div>
<!-- Mainly scripts -->
<script src="/admin/js/bootstrap.min.js"></script>
<script src="/admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/admin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="/admin/js/inspinia.js"></script>
<script src="/admin/js/plugins/pace/pace.min.js"></script>
<script src="/admin/js/common.js"></script>
<!-- Toastr script -->
<script src="/admin/js/plugins/toastr/toastr.min.js"></script>
<script src="/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="/admin/js/plugins/sweetalert/sweetalert.min.js"></script>


<script src="/static/summernote/summernote.min.js"></script>
<script src="/static/summernote/lang/summernote-zh-CN.js"></script>
<script src="/static/bootstrap-fileinput/js/fileinput.min.js"></script>
<script src="/static/bootstrap-fileinput/themes/fa/fa.js"></script>
<script src="/static/bootstrap-fileinput/js/locales/zh.js"></script>
<script src="/static/js/jQuery-imgBox/jquery.imgbox.js"></script>
<script>
    $(document).ready(function () {

        $('.summernote').summernote({
            lang: 'zh-CN',
            height: 400,
            minHeight: 300,
            callbacks: {
                onImageUpload: function (files) { //the onImageUpload API
                    img = sendFile(files[0]);
                }
            }
        });

        function sendFile(file) {
            var data = new FormData();
            data.append("file_data", file);
            $.ajax({
                data: data,
                type: "POST",
                url: "<?php echo Url('Upload/picture'); ?>",
                cache: false,
                contentType: false,
                processData: false,
                success: function(response) {
                    var data = $.parseJSON(response);
                    $(".summernote").summernote('insertImage', data.data, 'image name'); // the insertImage API
                }
            });
        }

        console.log($(this).val())
        $('.send_type').on('ifChecked', function(event){
            switch ($(this).val()) {
                case '0' :
                    $("#send_target").empty();
                    $("#send_target").append("<option value='0'>所有人</option>");
                    break;
                case '1':
                    $.ajax({
                        type: "get",
                        url: "<?php echo Url('getDepartment'); ?>",
                        success: function(response) {
                            $("#send_target").empty();
                            $.each(response.department, function(i,item){
                                $("#send_target").append("<option value='"+item.id+"'>"+item.name+"</option>");
                            });
                        }
                    });
                    break;
                case '2':
                    $.ajax({
                        type: "get",
                        url: "<?php echo Url('getTag'); ?>",
                        success: function(response) {
                            $("#send_target").empty();
                            $.each(response.taglist, function(i,item){
                                $("#send_target").append("<option value='"+item.tagid+"'>"+item.tagname+"</option>");
                            });
                        }
                    });
                    break;
            }
        });
    });

    $("#input-file").fileinput({
        showPreview: false,
        language: 'zh', //设置语言
        uploadUrl: '<?php echo Url("Upload/picture"); ?>', //上传的地址
        allowedFileExtensions: ['png','jpg','gif','png','jpeg'],
        maxFileSize: 1024 * 200,
    }).on("filebatchselected", function(event, files) {
        $(this).fileinput("upload");
    }).on('fileuploaded', function(event, data, previewId, index) {
        var response = $.parseJSON(data.response);
        if(response.code == 1) {
            $("input[name='front_cover']").val(response.data);
        } else {
            updateAlert(response.msg, 'warning');
        }
    });

    $(".front_cover").imgbox({
        overlayShow: false,
        hideOnContentClick: true,
        slideshow: false,
        theme: 'dark',
        alignment: 'center',       // Position - may be auto OR center.
        allowMultiple: false,
    });

//把content内容赋给隐藏表单

        $('.btn-primary').click(function(){
            $('.to_hiden').attr('value',$('.panel-body').text());
        })




</script>

</body>
</html>
